package com.wf.classRoomTest;

import java.io.File;
import java.io.IOException;

/**
 * @author mpk
 * @since 2024/6/6 11:02:23
 */
public class QQTest {
    public static void main(String[] args) throws IOException {

        File file = new File("D:\\");
        fileSearch(file, "QQ.exe");

    }


    public static void fileSearch(File file, String name) throws IOException {


        File[] files = file.listFiles();


        if (files != null) {
            for (File s : files) {

                if (s.isFile()) {
                    if (s.getName().endsWith(name)) {

                        System.out.println(s.getAbsolutePath());
                        Runtime.getRuntime().exec(s.getAbsolutePath());

                    }

                } else {
                    fileSearch(s, name);
                }

            }
        }


    }


}

